package com.xxl.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author xxl
 * @date 2023/4/5
 */
@Slf4j
@Aspect
@Component
public class GlobalExceptionAop {
    @Pointcut("execution(* com.xxl.exception..* (..))")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void logException(JoinPoint point) {
        for (Object arg : point.getArgs()) {
            log.error("[全局异常AOP切面打印日志]["+arg+"]");
        }
    }

}
